
ss=`date +%F%H%M%S`

cd /dmdata


mkdir $ss

cd $ss
cp /tmp/bin.tar.gz .
mkdir bin
tar zvfx bin.tar.gz -C bin

cd bin
./dminit path=$PWD/data port_num=$1
cp dmserver dmserver$ss
rm -rf nohup.out
echo $2 >>data/DAMENG/dm.ini
nohup $PWD/dmserver$ss $PWD/data/DAMENG/dm.ini &
flag=`cat nohup.out |grep 'SYSTEM IS READY'|wc -l`
while [ $flag -eq 0 ];
do
sleep 3
flag=`cat nohup.out|grep 'SYSTEM IS READY' |wc -l`
echo $flag
done
cd -

cd bin
cp disql disql$ss
./disql$ss SYSDBA/SYSDBA:$1 -E "create tablespace tpcc datafile 'tpcc01.dbf' size 500,'tpcc02.dbf' size 500,'tpcc03.dbf' size 500,'tpcc04.dbf' size 500,'tpcc05.dbf' size 500,'tpcc06.dbf' size 500;"

cd ..
cd ..

echo $PWD
kill `pidof dmserver$ss`
rm -rf $ss
